home *** CD-ROM | disk | FTP | other *** search
- /*
- * Copyright (C) 1993, 1994 Marc Parmet.
- * This file is part of the Macintosh port of GNU Emacs.
- *
- * GNU Emacs is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- */
-
- #include "stdio.h"
-
- static void
- cat_file(FILE *fp,char *fname)
- {
- static int i = 0;
- register char c;
-
- if (fname) {
- if (i++ > 0) printf("\n");
- printf("%s:\n",fname);
- }
-
- while ((c = getc(fp)) != EOF)
- putchar(c);
- }
-
- int
- main(int argc,char **argv)
- {
- int k;
-
- if (argc == 1)
- cat_file(stdin,0L);
- else
- for (k = 1; k<argc; ++k) {
- char *fname = argv[k];
- FILE *fp = fopen(fname,"r");
- if (fp == 0L) {
- printf("%s: file '%s' not found\n",argv[0],fname);
- continue;
- }
- cat_file(fp,fname);
- fclose(fp);
- }
-
- return 0;
- }
-